package com.tc.watercardrechargeserver.controller;


import com.tc.watercardrechargeserver.repository.dao.User;
import com.tc.watercardrechargeserver.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * company: iot.chinamobile<br>
 * date: 2022/1/27 <br>
 * <p>
 * description:<br>
 * 业务名：
 * 文件名:
 * </p>
 *
 * @author tangcan@cmiot.chinamobile.com
 * @version 0.12.0
 */
@RestController
@RequestMapping("/user")
public class UserController {
    //服务
    @Resource
    private UserService userService;

    //获取用户数据
    @GetMapping(value="/test",produces="application/json;charset=UTF-8")
    public User test(@RequestParam String id) {
        System.out.println("测试");
        return new User("{'text':'测试内容'}",id);
    }
    @RequestMapping("/query/{name}")
    public User queryUserByName(@PathVariable("name") String name){
        System.out.println("name:"+name);
        return userService.getUserByName(name);
    }
}
